﻿#define _CRT_SECURE_NO_WARNINGS/*猜数字游戏*/
#include<stdio.h>
#include<stdlib.h>
void menu()
{
	printf("********************************\n");
	printf("*********** 1.开始游戏 *********\n");
	printf("*********** 0.退出 *************\n");
	printf("********************************\n");

}

void youxi()
{
	int b, c = 0;
	b = rand() % 100 + 1;
	/*printf("%d", b);*/
	printf("请输入数值>:");

	while (1)
	{
		scanf("%d", &c);
		if (c < b)
		{
			printf("小了\n");
		}
		else if (c > b)
		{
			printf("大了\n");
		}
		else
		{
			printf("恭喜你 猜对了！\n"); break;
		}
	}
}



int main()
{
	srand((unsigned int)time(NULL));
	int a;



	while (1)
	{
		menu();
		printf("请选择>:");
		scanf("%d", &a);
		if (a == 1)
		{
			youxi(); continue;
		}
		if (a == 0)
		{
			printf("退出成功\n");
			break;
		}
		else
			printf("输错了，重新输！\n");

	}

	return 0;
}